<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8"/>
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">

    <title>用户管理</title>

    <link href="../plugin/bootstrap-3.3.7/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-table-1.11.1/bootstrap-table.min.css" rel="stylesheet"/>
    <link href="../plugin/sweetalert-6.6.2/sweetalert2.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-3.3.7/plugin/file_input/fileinput.min.css" rel="stylesheet"/>
    <link href="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.min.css" rel="stylesheet"/>
    <link href="../plugin/jquery-zoomify/zoomify.min.css" rel="stylesheet"/>

    <script src="../plugin/jquery-3.2.1/jquery-3.2.1.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/js/bootstrap.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/file_input/fileinput.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/file_input/local_zh.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.min.js"></script>
    <script src="../plugin/bootstrap-3.3.7/plugin/datatimepicker/bootstrap-datetimepicker.zh-CN.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/bootstrap-table.min.js"></script>
    <script src="../plugin/bootstrap-table-1.11.1/locale/bootstrap-table-zh-CN.min.js"></script>
    <script src="../plugin/sweetalert-6.6.2/sweetalert2.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.formautofill.min.js"></script>
    <script src="../plugin/jquery-zoomify/zoomify.min.js"></script>
    <script src="../plugin/jquery-3.2.1/jquery.serializejson.js"></script>
    <script src="../plugin/soul/utils3.js"></script>
    <script src='../base/base.js'></script>
</head>
<body>

<script>
    $(function () {
        var resp = AjaxUtil.isLogin();
        if (!resp) return;

        var module = 'apply';

        var query = [];
        // 工具条配置
        var toolbar = {
            default: [false, false, false, false],// back;add;edit;remove
            dialog: [50, 2, 9],//对话框参数:模态框宽度(百分比);表单标题宽度;表单输入框宽度
            extra: [{
                name: '兑换BHPC',
                glyphicon: 'list',
                onclick: 'buyBhpcWhitelist',
            }]
        };
        var bootstrapTable = {
            columns: [{
                radio: true
            }, {
                field: 'applyId',
                title: '申请编号',
            }, {
                field: 'userId',
                title: '用户Id',
            }, {
                field: 'bitcoinCount',
                title: '比特币数量',
            }, {
                field: 'ethereumCount',
                title: '以太币数量',
            }, {
                field: 'createDate',
                title: '申请时间',
                formatter: BootstrapTableUtil.formatter.datetime
            }, {
                field: 'status',
                title: '状态',
                align: 'center',
                formatter: function (verify, row, index) {
                    if (verify == 1) {
                        return '已兑换成BHPC';
                    } else if (verify == 0) {
                        return '已提交';
                    }
                }
            }],
        };
        var formElement = [];
        apply = SingleTablePageCreateUtil.createInstance(module, query, toolbar, formElement, bootstrapTable);

        apply.buyBhpcWhitelist = function () {
            var row = TablePageCreatePublicUtil.getRowFromTable('#apply_table');
            if (!row) return false;
            if (row.status == 1) {
                SwalUtil.error("已兑换成BHPC,请不要重复兑换");
                return;
            }
            var resp = AjaxUtil.postJson('apply/buyBhpcWhitelist', {
                applyId: row.applyId,
            });


            if (resp) {
                SwalUtil.success(resp.msg);
                $('#apply_table').bootstrapTable('refresh');
            }
        }

    });
</script>
</body>

</html>